package com.acsior.hibernate.vo;

// default package

import java.util.Date;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.acsior.dac.impl.hibernate.vo.GeneratorKey;
import com.acsior.dac.impl.hibernate.vo.HibernateVO;

/**
 * CdReceiptHeader entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "cdReceiptHeaders")
@GeneratorKey(tableName = "cdReceiptHeaders")
public class CdReceiptHeaderVO extends HibernateVO {
	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 6439986515605395257L;

	@Column(name = "calculated", nullable = false)
	private boolean calculated;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "cashDeskID", nullable = false)
	private CdCashDeskVO cdCashDesk;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cdReceiptHeader")
	private List<CdReceiptBodyVO> cdReceiptBodies;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cdReceiptHeader")
	private List<CdReceiptsCanceledVO> cdReceiptsCanceleds;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "receiptStatus", nullable = false)
	private CdReceiptStatusVO cdReceiptStatus;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "receiptTypeID", nullable = false)
	private CdReceiptTypeVO cdReceiptType;

	@Column(name = "isCanceled", nullable = false)
	private boolean isCanceled;

	@Column(name = "lastStatusChange", nullable = false, length = 23)
	private Date lastStatusChange;

	@Id
	@Column(name = "receiptHeaderID", unique = true, nullable = false)
	@GeneratedValue(strategy=GenerationType.AUTO)
	private long receiptHeaderId;

	@Column(name = "receiptName", nullable = false)
	private String receiptName;

	@Column(name = "receiptUIN", nullable = false)
	private Integer receiptUin;

	@Column(name = "registrationTime", nullable = false, length = 23)
	private Date registrationTime;

	// Constructors

	/** default constructor */
	public CdReceiptHeaderVO() {
		this.cdReceiptBodies  = new ArrayList<CdReceiptBodyVO>();
		this.cdReceiptsCanceleds  = new ArrayList<CdReceiptsCanceledVO>();
	}

	
	/**
	 * @return стойността на calculated
	 */
	public boolean isCalculated() {
		return this.calculated;
	}

	
	/**
	 * @param calculated се залага в calculated
	 */
	public void setCalculated(boolean calculated) {
		this.calculated = calculated;
	}

	
	/**
	 * @return стойността на cdCashDesk
	 */
	public CdCashDeskVO getCdCashDesk() {
		return this.cdCashDesk;
	}

	
	/**
	 * @param cdCashDesk се залага в cdCashDesk
	 */
	public void setCdCashDesk(CdCashDeskVO cdCashDesk) {
		this.cdCashDesk = cdCashDesk;
	}

	
	/**
	 * @return стойността на cdReceiptBodies
	 */
	public List<CdReceiptBodyVO> getCdReceiptBodies() {
		return this.cdReceiptBodies;
	}

	
	/**
	 * @param cdReceiptBodies се залага в cdReceiptBodies
	 */
	public void setCdReceiptBodies(List<CdReceiptBodyVO> cdReceiptBodies) {
		this.cdReceiptBodies = cdReceiptBodies;
	}

	
	/**
	 * @return стойността на cdReceiptsCanceleds
	 */
	public List<CdReceiptsCanceledVO> getCdReceiptsCanceleds() {
		return this.cdReceiptsCanceleds;
	}

	
	/**
	 * @param cdReceiptsCanceleds се залага в cdReceiptsCanceleds
	 */
	public void setCdReceiptsCanceleds(List<CdReceiptsCanceledVO> cdReceiptsCanceleds) {
		this.cdReceiptsCanceleds = cdReceiptsCanceleds;
	}

	
	/**
	 * @return стойността на cdReceiptStatus
	 */
	public CdReceiptStatusVO getCdReceiptStatus() {
		return this.cdReceiptStatus;
	}

	
	/**
	 * @param cdReceiptStatus се залага в cdReceiptStatus
	 */
	public void setCdReceiptStatus(CdReceiptStatusVO cdReceiptStatus) {
		this.cdReceiptStatus = cdReceiptStatus;
	}

	
	/**
	 * @return стойността на cdReceiptType
	 */
	public CdReceiptTypeVO getCdReceiptType() {
		return this.cdReceiptType;
	}

	
	/**
	 * @param cdReceiptType се залага в cdReceiptType
	 */
	public void setCdReceiptType(CdReceiptTypeVO cdReceiptType) {
		this.cdReceiptType = cdReceiptType;
	}

	
	/**
	 * @return стойността на isCanceled
	 */
	public boolean isCanceled() {
		return this.isCanceled;
	}

	
	/**
	 * @param isCanceled се залага в isCanceled
	 */
	public void setCanceled(boolean isCanceled) {
		this.isCanceled = isCanceled;
	}

	
	/**
	 * @return стойността на lastStatusChange
	 */
	public Date getLastStatusChange() {
		return this.lastStatusChange;
	}

	
	/**
	 * @param lastStatusChange се залага в lastStatusChange
	 */
	public void setLastStatusChange(Date lastStatusChange) {
		this.lastStatusChange = lastStatusChange;
	}

	
	/**
	 * @return стойността на receiptHeaderId
	 */
	public long getReceiptHeaderId() {
		return this.receiptHeaderId;
	}

	
	/**
	 * @param receiptHeaderId се залага в receiptHeaderId
	 */
	public void setReceiptHeaderId(long receiptHeaderId) {
		this.receiptHeaderId = receiptHeaderId;
	}

	
	/**
	 * @return стойността на receiptName
	 */
	public String getReceiptName() {
		return this.receiptName;
	}

	
	/**
	 * @param receiptName се залага в receiptName
	 */
	public void setReceiptName(String receiptName) {
		this.receiptName = receiptName;
	}

	
	/**
	 * @return стойността на receiptUin
	 */
	public Integer getReceiptUin() {
		return this.receiptUin;
	}

	
	/**
	 * @param receiptUin се залага в receiptUin
	 */
	public void setReceiptUin(Integer receiptUin) {
		this.receiptUin = receiptUin;
	}

	
	/**
	 * @return стойността на registrationTime
	 */
	public Date getRegistrationTime() {
		return this.registrationTime;
	}

	
	/**
	 * @param registrationTime се залага в registrationTime
	 */
	public void setRegistrationTime(Date registrationTime) {
		this.registrationTime = registrationTime;
	}

	/**
	 * @see com.acsior.dac.data.Data#getId()
	 */
	@Override
	public Object getId() {
		return getReceiptHeaderId();
	}

	/**
	 * @see com.acsior.dac.impl.hibernate.vo.HibernateVO#setId(java.lang.Object)
	 */
	@Override
	public void setId(Object id) {
		// този е автоинкремент
		setReceiptHeaderId(Long.class.cast(id));
	}
}